package com.joysuch.wwyt.attendance.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.joysuch.wwyt.attendance.bean.AttendanceDayBean;
import com.joysuch.wwyt.attendance.bean.AttendanceUserPageBean;
import com.joysuch.wwyt.attendance.bean.AttendanceUserParam;
import com.joysuch.wwyt.attendance.dto.AttendanceUserDto;
import com.joysuch.wwyt.attendance.entity.AttendanceGroup;
import com.joysuch.wwyt.attendance.entity.AttendanceUser;
import com.joysuch.wwyt.core.entity.BaseUser;
import com.joysuch.wwyt.core.exception.ApiBusinessException;

import java.util.List;

/**
 * <p>
 * 服务类
 * </p>
 *
 * @author zqw
 * @since 2022-03-03
 */
public interface AttendanceUserService extends IService<AttendanceUser> {

    /**
     * 保存人员排班
     *
     * @param dto
     * @return
     */
    void saveUserTask(AttendanceUserDto dto) throws ApiBusinessException;

    /**
     * 手动生成定时任务
     *
     * @param year
     * @param month
     */
    void saveFixTask(Integer year, Integer month);

    /**
     * 定时任务-生成人员排班
     *
     * @param orgCode
     * @param tenentId
     * @param year
     * @param month
     */
    void createUserTask(String orgCode, Long tenentId, Integer year, Integer month);

    /**
     * 人员排班分页
     *
     * @param pageParam
     * @return
     */
    AttendanceUserPageBean pageUserTask(AttendanceUserParam pageParam);

    /**
     * 获取考勤组配置的参与人员信息
     *
     * @param group
     * @param departId
     * @param userName
     * @return
     */
    List<BaseUser> getGroupStaffList(AttendanceGroup group, Long departId, String userName);

    /**
     * 后续考勤组人员排班信息
     *
     * @param groupId
     * @param year
     * @param month
     * @return
     */
    List<AttendanceUser> getAttendanceUserByGroupAndYearAndMonth(Long groupId, int year, int month);

    /**
     * 创建人员该月固定排班
     *
     * @param groupId         考勤组id
     * @param userList        返回值
     * @param oldUsers        该月已有排班
     * @param attendanceJson  考勤组排班设置
     * @param participantIds  参与对象
     * @param participantType 参与对象类型
     * @param dayBeans        该月每天信息
     * @param renewFlag      0不更新旧数据  1更新旧数据
     * @return userList
     */
    List<AttendanceUser> saveFixUserTask(Long groupId, List<AttendanceUser> userList, List<AttendanceUser> oldUsers, String attendanceJson, String participantIds, Integer participantType, List<AttendanceDayBean> dayBeans, Integer renewFlag);
}
